diff options
| author | Adam Soltys <[email protected]> | 2024-09-24 20:12:43 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-09-24 20:12:43 -0700 |
| commit | b008ad7a87ae101d814d774533ed36243b9b8457 (patch) | |
| tree | 42101a3ccf47f7b7290637700b90a843476e56f7 /src/routes/(app)/[username]/+layout.server.ts | |
| parent | e139c25a127c0b3fb655e7a07ed6963335a0d025 (diff) | |
| parent | 550678bee306d1593dc4ba561bf34421f2657484 (diff) | |
| download | coinos-ui-b008ad7a87ae101d814d774533ed36243b9b8457.tar.gz coinos-ui-b008ad7a87ae101d814d774533ed36243b9b8457.zip | |
Merge branch 'self-custody'
Diffstat (limited to 'src/routes/(app)/[username]/+layout.server.ts')
| -rw-r--r-- | src/routes/(app)/[username]/+layout.server.ts | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/routes/(app)/[username]/+layout.server.ts b/src/routes/(app)/[username]/+layout.server.ts index 11e6d45c..9a520036 100644 --- a/src/routes/(app)/[username]/+layout.server.ts +++ b/src/routes/(app)/[username]/+layout.server.ts @@ -1,17 +1,24 @@ import { get } from "$lib/utils"; import { error } from "@sveltejs/kit"; -export let load = async ({ cookies, depends, params: { username } }) => { +export let load = async ({ + cookies, + depends, + params: { username }, + parent, +}) => { depends("app:user"); try { let subject = await get(`/users/${username}`); + let { user } = await parent(); + if (!user) user = subject; let expires = new Date(); expires.setSeconds(expires.getSeconds() + 380 * 24 * 60 * 60); cookies.set("username", username, { path: "/", expires }); - return { subject }; + return { subject, user }; } catch (e) { error(500, "Unable to retrieve user account data"); } |
